from datetime import datetime

from django.contrib.auth.models import User
from django.db import models


class WordBook(models.Model):
    wordbook_id = models.IntegerField(primary_key=True)
    # 单词书名称
    title = models.CharField(max_length=32)
    # 创建添加时间
    pub_date = models.DateField()
    # 是否公开
    is_public = models.BooleanField(default=True)
    # 密码
    password = models.CharField(max_length=64, default='')
    # 是否需要密码
    need_pwd = models.BooleanField(default=False)
    # 所属用户
    master = models.ForeignKey(User, on_delete=models.CASCADE, null=True, default=None)

    def __str__(self):
        return self.title

    # class Meta:
    #     db_table = '公共单词本'
